<script>
	/**
	 * vuex管理登陆状态，具体可以参考官方登陆模板示例
	 */
	import { mapMutations } from 'vuex'
	import Vue from 'vue'
	export default {
		methods: { 
			...mapMutations(['login'])
		},
		onLaunch: function() {
			let userInfo = uni.getStorageSync('userInfo') || ''
			if(userInfo.id){
				//更新登陆状态
				uni.getStorage({
					key: 'userInfo',
					success: (res) => {
						this.login(res.data);
					}
				})
			}
			uni.getSystemInfo({
				success:function(e){
					let menu = wx.getMenuButtonBoundingClientRect()
					Vue.prototype.statusBar = e.statusBarHeight //状态栏高度
					Vue.prototype.customBar = (menu.bottom + menu.top) - (e.statusBarHeight * 2)
					Vue.prototype.titleBarHeight = (menu.bottom + menu.top) - e.statusBarHeight //标题高度
				}
			})
		}
	}
</script>